/*
   file : calc.h
   本文件用于词法和语法分析器的可重入实现
   University of Jiangsu
   memoryDB      2010.6
*/


#include "def_head.h"
#ifndef __CALC_H__
#define __CALC_H__

typedef struct parse_parm_s
{
	void *yyscanner;            /* state of the lexer */
	char buf[MAX_COMMAND]; 		/* buffer we read from */
	int	pos; 		            /* current position in buf */
	int	length;		            /* length of buf */
}parse_parm;

typedef struct
{
	int intval;
	double floatval;
	char *strval;
	int subtok;
}YYSTYPE;

int yylex(YYSTYPE *, void *);

void parse(sql_sentence *);

#define YY_EXTRA_TYPE	parse_parm *

/*
** forward declaration of lexer/parser functions 
** so the compiler shuts up about warnings
*/
int yylex_init(void **);
int yylex_destroy(void *);
void yyset_extra(YY_EXTRA_TYPE, void *);
int yyparse(parse_parm *, void *,sql_sentence *);
int yyerror(const char *);

#endif
